package com.wuye.zlgl.service.impl;

import java.util.List;

import com.wuye.parking.domain.WyParkingLot;
import com.wuye.parking.mapper.WyParkingLotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuye.zlgl.mapper.WyParkingRentMapper;
import com.wuye.zlgl.domain.WyParkingRent;
import com.wuye.zlgl.service.IWyParkingRentService;

/**
 * 车位租赁Service业务层处理
 * 
 * @author 杨
 * @date 2024-11-22
 */
@Service
public class WyParkingRentServiceImpl implements IWyParkingRentService 
{
    @Autowired
    private WyParkingRentMapper wyParkingRentMapper;
    @Autowired
    private WyParkingLotMapper wyParkingLotMapper;

    @Override
    public WyParkingRent selectWyParkingRentByParkId(Long parkId) {
        return wyParkingRentMapper.selectWyParkingRentByParkId(parkId);
    }

    /**
     * 查询车位租赁
     * 
     * @param id 车位租赁主键
     * @return 车位租赁
     */
    @Override
    public WyParkingRent selectWyParkingRentById(Long id)
    {
        return wyParkingRentMapper.selectWyParkingRentById(id);
    }

    /**
     * 查询车位租赁列表
     * 
     * @param wyParkingRent 车位租赁
     * @return 车位租赁
     */
    @Override
    public List<WyParkingRent> selectWyParkingRentList(WyParkingRent wyParkingRent)
    {
        return wyParkingRentMapper.selectWyParkingRentList(wyParkingRent);
    }

    /**
     * 新增车位租赁
     * 
     * @param wyParkingRent 车位租赁
     * @return 结果
     */
    @Override
    public int insertWyParkingRent(WyParkingRent wyParkingRent)
    {
        WyParkingLot wyParkingLot = new WyParkingLot();
        wyParkingLot.setParkId(Long.parseLong(wyParkingRent.getParkingLocation()));
        wyParkingLot.setParkStatus("1");
        wyParkingLotMapper.updateWyParkingLot(wyParkingLot);
        return wyParkingRentMapper.insertWyParkingRent(wyParkingRent);
    }

    /**
     * 修改车位租赁
     * 
     * @param wyParkingRent 车位租赁
     * @return 结果
     */
    @Override
    public int updateWyParkingRent(WyParkingRent wyParkingRent)
    {
        return wyParkingRentMapper.updateWyParkingRent(wyParkingRent);
    }

    /**
     * 批量删除车位租赁
     * 
     * @param ids 需要删除的车位租赁主键
     * @return 结果
     */
    @Override
    public int deleteWyParkingRentByIds(Long[] ids)
    {
        return wyParkingRentMapper.deleteWyParkingRentByIds(ids);
    }

    /**
     * 删除车位租赁信息
     * 
     * @param id 车位租赁主键
     * @return 结果
     */
    @Override
    public int deleteWyParkingRentById(Long id)
    {
        return wyParkingRentMapper.deleteWyParkingRentById(id);
    }

    @Override
    public WyParkingRent selectWyParkingRentByBalconyunithomeId(Long balconyunithomeId) {
        return wyParkingRentMapper.selectWyParkingRentByBalconyunithomeId(balconyunithomeId);
    }
}
